using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Admin_LinkCategories : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }


    protected void but_Save_Click(object sender, EventArgs e)
    {
        //SqlDataSource1.Insert();
        LinkManager.InsertLinkCategory(tbo_Desc.Text, tbo_Title.Text);
               
        tbo_Desc.Text = "";
        tbo_Title.Text = "";
    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            //on edit this is no delete button and this will chuck an exception if we try and get the button.
            if (e.Row.Cells[4].Controls.Count > 0)
            {
                LinkButton lbuDelete = (LinkButton)e.Row.Cells[4].Controls[0];
                lbuDelete.OnClientClick = "return confirm(\'Are you sure you want to delete? This can not be undone!\');";
            }// end of the check to see if there are any controls in the cell
           

           // the following code finds the delete button cell 
           // for (int intCounter = 0; intCounter < e.Row.Cells.Count; intCounter++)
           // {
           //     try
           //     {
           //         LinkButton lbuDelete = (LinkButton)e.Row.Cells[4].Controls[0];

           //         if (lbuDelete.Text.ToLower().StartsWith("d"))
           //         {
           //             Response.Redirect(intCounter.ToString());
           //             //lbuDelete.OnClientClick = "return confirm(\'Are you sure you want to delete? This can not be undone.\');";
           //         }
           //     }
           //     catch
           //     {
           //     }
           //}    
        }// end of the if 
    }// end of the method
}// end of the class
